package com.mapgoo.implicitTest

import java.io.File

import scala.io.Source

/**
  *
  * @author eureka.wh
  * @since 2019-05-31 11:37
  */
// 隐式类
object ParamDemo04 {

  implicit class FileEnhancer(file: File) {
    def read = Source.fromFile(file.getPath).mkString
  }
  implicit class Op(x: Int) {
    def add(second: Int) = x + second
  }
}

object Implicits_Class {

  def main(args: Array[String]): Unit = {
     import ParamDemo04._

     println(new File("xxx").read)
     println(1.add(2))
  }

}
